class CreatePages < ActiveRecord::Migration
  def self.up
    create_table :pages do |t|
      t.column "parent_id", :integer, :references => :pages
      t.column "name", :string, :size => 40, :null => false
      t.column "created_at", :timestamp, :null => false
      t.column "updated_at", :timestamp, :null => false
      t.column "slug", :string
      t.column "position", :integer
    end
    
    create_table :revisions do |t|
      t.column "page_id", :integer
      t.column "content", :text
      t.column "redirect_to", :integer, :references => :pages
      t.column "published", :boolean, :default => false
      t.column "user_id", :integer
      t.column "created_at", :timestamp, :null => false
    end
  end

  def self.down
    drop_table :revisions
    drop_table :pages
  end
end
